package com.lab1.anxuan.controller;

import org.springframework.boot.CommandLineRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;

/**
 * FileName:AnxuanController
 * Author Gao
 * Data: 2021/3/3010:08
 * Description: 简单的Spring Mvc 测试
 * <author>    <time>    <version>  <desc>
 * <p>
 * 作者名字     修改时间      版本号     描述
 */
@RestController
public class AnxuanController {
    @RequestMapping("/hello")
    public String index(){
        return "Hello,Anxuan";
    }
    @Bean
    public CommandLineRunner commandLineRunner(ApplicationContext ctx){
        return args -> {
            System.out.println("由spirngboot 注册的 所有 Bean");
            String[] beanNames = ctx.getBeanDefinitionNames();
            Arrays.sort(beanNames);
            for (String beanName:beanNames
            ) {
                System.out.println(beanName);

            }
        };
    }
}
